package com.tjshop.android.model.tj.json;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.content.Context;
import android.os.Message;

import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.Request.Method;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.tjshop.android.constants.UrlConfigs;
import com.tjshop.android.mcv.GlobeVars;
import com.tjshop.android.model.BaseObject;

public class Address extends BaseObject implements Serializable {

	 private String address_id;//"address_id": "1",
     private String address_name;//"address_name": "2",
     private String user_id;//"user_id": "1",
     private String consignee;//"consignee": "程明科",
     private String email;//"email": "1256501713@qq.com",
     private String country;//"country": "1",
     private String province;//"province": "3",
     private String city;//"city": "37",
     private String district;//"district": "409",
     private String address;//"address": "安徽省芜湖市包河区",
     private String zipcode;//"zipcode": "",
     private String tel;//"tel": "18019907885",
     private String mobile;//"mobile": "",
     private String sign_building;//"sign_building": "",
     private String best_time;//"best_time": ""vate String path;// "adcode":"1419894247319785423.jpg",

	public String getAddress_id() {
		return address_id;
	}


	public void setAddress_id(String address_id) {
		this.address_id = address_id;
	}


	public String getAddress_name() {
		return address_name;
	}


	public void setAddress_name(String address_name) {
		this.address_name = address_name;
	}


	public String getUser_id() {
		return user_id;
	}


	public void setUser_id(String user_id) {
		this.user_id = user_id;
	}


	public String getConsignee() {
		return consignee;
	}


	public void setConsignee(String consignee) {
		this.consignee = consignee;
	}


	public String getEmail() {
		return email;
	}


	public void setEmail(String email) {
		this.email = email;
	}


	public String getCountry() {
		return country;
	}


	public void setCountry(String country) {
		this.country = country;
	}


	public String getProvince() {
		return province;
	}


	public void setProvince(String province) {
		this.province = province;
	}


	public String getCity() {
		return city;
	}


	public void setCity(String city) {
		this.city = city;
	}


	public String getDistrict() {
		return district;
	}


	public void setDistrict(String district) {
		this.district = district;
	}


	public String getAddress() {
		return address;
	}


	public void setAddress(String address) {
		this.address = address;
	}


	public String getZipcode() {
		return zipcode;
	}


	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}


	public String getTel() {
		return tel;
	}


	public void setTel(String tel) {
		this.tel = tel;
	}


	public String getMobile() {
		return mobile;
	}


	public void setMobile(String mobile) {
		this.mobile = mobile;
	}


	public String getSign_building() {
		return sign_building;
	}


	public void setSign_building(String sign_building) {
		this.sign_building = sign_building;
	}


	public String getBest_time() {
		return best_time;
	}


	public void setBest_time(String best_time) {
		this.best_time = best_time;
	}


	public void parse(JSONObject obj) {
		setAddress(getString(obj, "address"));
		setAddress_id(getString(obj, "address_id"));
		setAddress_name(getString(obj, "address_name"));
		setBest_time(getString(obj, "best_time"));
		setCity(getString(obj, "city"));
		setConsignee(getString(obj, "consignee"));
		setCountry(getString(obj, "country"));
		setDistrict(getString(obj, "district"));
		setEmail(getString(obj, "email"));
		setMobile(getString(obj, "mobile"));
		setProvince(getString(obj, "province"));
		setSign_building(getString(obj, "sign_building"));
		setTel(getString(obj, "tel"));
		setUser_id(getString(obj, "user_id"));
		setZipcode(getString(obj, "zipcode"));
	}


	@Override
	public void parse(JSONArray data) {
		
	}
	
	public boolean delete(Context  context){
		RequestQueue mQueue = Volley.newRequestQueue(context);
		StringRequest stringRequest = new StringRequest(Method.GET,
				UrlConfigs.URL_DELETE_ADDRESS + "?t=" + GlobeVars.token+"&aid="+getAddress_id(),
				new Response.Listener<String>() {
					@Override
					public void onResponse(String response) {
					}
				}, new Response.ErrorListener() {

					@Override
					public void onErrorResponse(VolleyError error) {

					}

				});

		mQueue.add(stringRequest);
		return true;
	}
}
